import { lazy } from "react";
import { StateType } from "../type";

const Home = lazy(() => import("../pages/Home"));
const Error = lazy(() => import("../pages/Error"));
const Login = lazy(() => import("../pages/Login"));
const List = lazy(() => import("../pages/List"));
const My = lazy(() => import("../pages/My"));
const Cart = lazy(() => import("../pages/Cart"));
const Layout = lazy(() => import("../pages/Layout"));

export const rendeRoutes: StateType[] = [
    {
        path: '/',
        element: <List />,
    },
    {
        path: '/my',
        element: <My />,
    },
    {
        path: '/cart',
        element: <Cart />,
    },
    {
        path: '/layout',
        element: <Layout />,
    }
]

export const router: StateType[] = [
    {
        path: '/',
        element: <Home />,
        children: rendeRoutes
    },
    {
        path: '/login',
        element: <Login />,
    },
    {
        path: '*',
        element: <Error />,
    }
]